<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>async基本操作.html</title>
</head>
<body>
<script type="text/javascript">
    //定义一个async函数
    async function main(){
        console.log('开始了')
        let a = await 'aaa';
        console.log(a);
        let b = await new Promise((resolve, reject)=>{
            resolve(()=>{console.log('bbbb')});
        });
        console.log(b);//这里面的b就是resolve()方法里面的一坨
       // b.then((data)=>{
       //      console.log(data);
       //  });
        return a;
    }

    let m = main();
    console.log(m);
    m.then((data)=>{
        console.log(data + ' success done');
    }).catch((error)=>{
        console.log(error)
    })

</script>
</body>
</html>